﻿using System;

namespace Sort
{
    class Program
    {
        public static Log logger;
        public static bool ArgsAreCorrect(string[] args)
        {
            if (args.Length != 2 || args[0].Length == 0 || args[1].Length == 0)
            {
                return false;
            }
            return true;
        }

        static void Main(string[] args)
        {
            try
            {
                logger = new Log();
                if (!ArgsAreCorrect(args))
                    throw new ArgumentException("Wrong command-line parameters");
                DateTime start = DateTime.Now;
                Sort.InputProcessing(args[0], args[1]);
                DateTime end = DateTime.Now;
                logger.Info((end - start).ToString());
                logger.WriteLogFile();
            }
            catch (Exception ex)
            {
                logger.Fatal(ex.Message);
                logger.WriteLogFile();
            }
        }
    }
}
